<template>
  <div>
    <!-- 面包屑 -->
    <heima-crumbs secondTitle="权限管理" ThirdTitle="权限列表"></heima-crumbs>
    <!-- 内容主题区 -->
    <el-card>
      <el-table :data="rightsList">
        <el-table-column label="序号" type="index"></el-table-column>
        <el-table-column label="权限名称" prop="authName"></el-table-column>
        <el-table-column label="路径" prop="auth"></el-table-column>
        <el-table-column label="权限等级" prop="level">
          <template slot-scope="scope">
            <el-tag v-if="scope.row.level === '0'" type="primary">一级</el-tag>
            <el-tag v-else-if="scope.row.level === '1'" type="success"
              >二级</el-tag
            >
            <el-tag v-else type="warning">三级</el-tag>
          </template>
        </el-table-column>
      </el-table>
    </el-card>
  </div>
</template>
<script>
import { getRightsList } from '@/api/power'
export default {
  name: 'rights',
  data() {
    return {
      rightsList: []
    }
  },
  methods: {
    async queryRightsList() {
      const res = await getRightsList()
      if (res.meta.status === 200) {
        this.rightsList = res.data
        this.$message.success(res.meta.msg)
        console.log(this.rightsList)
      } else {
        this.$message.eror(res.meta.msg)
      }
    }
  },
  mounted() {
    this.queryRightsList()
  }
}
</script>
<style lang="less" scope></style>
